package org.example.classtopia.Controller;

import org.example.classtopia.Service.CurriculumSyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/sync")
public class CurriculumSyncController {

    @Autowired
    private CurriculumSyncService curriculumSyncService;

    @PostMapping("/curriculum-to-course")
    public String syncCurriculumToCourse(@RequestParam Long userId) {
        try {
            curriculumSyncService.syncCurriculumToCourse(userId);
            return "同步成功";
        } catch (Exception e) {
            return "同步失败：" + e.getMessage();
        }
    }
}
